package com.huarui.task.service.provider;

import java.util.HashMap;
import java.util.Map;

import com.huarui.task.model.Task;
import com.huarui.task.model.WorkflowInfo;
import com.huarui.task.taskEnum.WorkFlowTaskNameEnum;

public class WorkflowInfoProvider {
	
	private Map<String, WorkflowInfo>  id2info;
	
	public void init(){
		if(id2info == null){
			id2info = new HashMap<String, WorkflowInfo>();
		}
		WorkflowInfo wf = new WorkflowInfo();
		wf.setTaskNameEn(WorkFlowTaskNameEnum.WORKFLOWID_TASKNAME_NOT_ONLINE_PURCHASE_ORDER.getTaskNameEn());
		wf.setTaskName(WorkFlowTaskNameEnum.WORKFLOWID_TASKNAME_NOT_ONLINE_PURCHASE_ORDER.getTaskName());
		wf.setJsModuleId("addOutPurchaseOrderWindowCreator");
		id2info.put(wf.getTaskNameEn(), wf);
		
		wf = new WorkflowInfo();
		wf.setTaskNameEn(WorkFlowTaskNameEnum.WORKFLOWID_TASKNAME_ONLINE_PURCHASE_ORDER.getTaskNameEn());
		wf.setTaskName(WorkFlowTaskNameEnum.WORKFLOWID_TASKNAME_ONLINE_PURCHASE_ORDER.getTaskName());
		wf.setJsModuleId("addAutoPurchaseOrderWindowCreator");
		id2info.put(wf.getTaskNameEn(), wf);
		
		wf = new WorkflowInfo();
		wf.setTaskNameEn(WorkFlowTaskNameEnum.WORKFLOWID_TASKNAME_NOT_ONLINE_SALE_ORDER.getTaskNameEn());
		wf.setTaskName(WorkFlowTaskNameEnum.WORKFLOWID_TASKNAME_NOT_ONLINE_SALE_ORDER.getTaskName());
		wf.setJsModuleId("addOutSaleOrderWindowCreator");
		id2info.put(wf.getTaskNameEn(), wf);
		
		wf = new WorkflowInfo();
		wf.setTaskNameEn(WorkFlowTaskNameEnum.WORKFLOWID_TASKNAME_ONLINE_SALE_ORDER.getTaskNameEn());
		wf.setTaskName(WorkFlowTaskNameEnum.WORKFLOWID_TASKNAME_ONLINE_SALE_ORDER.getTaskName());
		wf.setJsModuleId("addAutoSaleOrderWindowCreator");
		id2info.put(wf.getTaskNameEn(), wf);
	}

	public WorkflowInfo getInfo(String taskNameEn) {
		return id2info.get(taskNameEn);
	}

	public Map<String, WorkflowInfo> getInfoes() {
		return this.id2info;
	}
}
